package com.xja.cloud.controller;

import com.xja.cloud.entity.Product;
import com.xja.cloud.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("findDetail/{pid}")
    public Product findDetail(@PathVariable("pid") Integer pid){
        System.out.println("查询单个对象:" +pid);
        return  productService.findById(pid);
    }


}
